/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tubosmonterrey.cotizador.tb;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author rsoberanis
 */
@Entity
@Table(name = "tbclientes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tbclientes.findAll", query = "SELECT t FROM Tbclientes t"),
    @NamedQuery(name = "Tbclientes.findById", query = "SELECT t FROM Tbclientes t WHERE t.id = :id"),
    @NamedQuery(name = "Tbclientes.findByNom", query = "SELECT t FROM Tbclientes t WHERE t.nom = :nom"),
    @NamedQuery(name = "Tbclientes.findByDireccion", query = "SELECT t FROM Tbclientes t WHERE t.direccion = :direccion"),
    @NamedQuery(name = "Tbclientes.findByRfc", query = "SELECT t FROM Tbclientes t WHERE t.rfc = :rfc"),
    @NamedQuery(name = "Tbclientes.findByEmail", query = "SELECT t FROM Tbclientes t WHERE t.email = :email")})
public class Tbclientes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private String id;
    @Column(name = "nom")
    private String nom;
    @Column(name = "direccion")
    private String direccion;
    @Column(name = "rfc")
    private String rfc;
    @Column(name = "email")
    private String email;
    @OneToMany(mappedBy = "cliente")
    private Collection<TbcotizacionTmp> tbcotizacionTmpCollection;
    @JoinColumn(name = "vendedor", referencedColumnName = "id")
    @ManyToOne
    private Tbvendedores vendedor;
    @OneToMany(mappedBy = "cliente")
    private Collection<Tbcotizacion> tbcotizacionCollection;

    public Tbclientes() {
    }

    public Tbclientes(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public String getRfc() {
        return rfc;
    }

    public void setRfc(String rfc) {
        this.rfc = rfc;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @XmlTransient
    public Collection<TbcotizacionTmp> getTbcotizacionTmpCollection() {
        return tbcotizacionTmpCollection;
    }

    public void setTbcotizacionTmpCollection(Collection<TbcotizacionTmp> tbcotizacionTmpCollection) {
        this.tbcotizacionTmpCollection = tbcotizacionTmpCollection;
    }

    public Tbvendedores getVendedor() {
        return vendedor;
    }

    public void setVendedor(Tbvendedores vendedor) {
        this.vendedor = vendedor;
    }

    @XmlTransient
    public Collection<Tbcotizacion> getTbcotizacionCollection() {
        return tbcotizacionCollection;
    }

    public void setTbcotizacionCollection(Collection<Tbcotizacion> tbcotizacionCollection) {
        this.tbcotizacionCollection = tbcotizacionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tbclientes)) {
            return false;
        }
        Tbclientes other = (Tbclientes) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.tubosmonterrey.cotizador.tb.Tbclientes[ id=" + id + " ]";
    }
    
}
